package chapter12;

import org.junit.Test;

/**
 * @author : DuJiabao
 * @Date : 2021/2/20 16:03
 * @Project : thinking_in_java
 * @File : null.java
 * @Desc :
 */
public class FinallyTest {
  public static void main(String[] args) {
    try {
      throw new RuntimeException();
    } catch (Exception e) {
      System.out.println(e);
      return;
    } finally {
      System.out.println("finally");
    }
  }

  @Test
  public void test() {
    try {
      throw new OneException("throw new OneException()");
    } finally {
      return;
    }
  }

  @Test
  public void test2() {
    try {
      try {
        throw new RuntimeException("throw new OneException()");
      } finally {
        throw new RuntimeException("throw new TwoException()");
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

}

